﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package com.facebook.utils {
    import flash.utils.*;

    public class PostRequest {

        protected var _boundary:String = "-----";
        protected var postData:ByteArray;

        public function PostRequest(){
            this.createPostData();
        }
        public function getPostData():ByteArray{
            this.postData.position = 0;
            return (this.postData);
        }
        protected function writeBoundary():void{
            this.writeDoubleDash();
            var _local1:Number = 0;
            while (_local1 < this.boundary.length) {
                this.postData.writeByte(this.boundary.charCodeAt(_local1));
                _local1++;
            };
        }
        protected function writeDoubleDash():void{
            this.postData.writeShort(0x2D2D);
        }
        public function writeFileData(_arg1:String, _arg2:ByteArray, _arg3:String):void{
            var _local4:String;
            this.writeBoundary();
            this.writeLineBreak();
            _local4 = "Content-Disposition: form-data; filename=\"";
            var _local5:Number = 0;
            while (_local5 < _local4.length) {
                this.postData.writeByte(_local4.charCodeAt(_local5));
                _local5++;
            };
            this.postData.writeUTFBytes(_arg1);
            this.writeQuotationMark();
            this.writeLineBreak();
            _local4 = _arg3;
            _local5 = 0;
            while (_local5 < _local4.length) {
                this.postData.writeByte(_local4.charCodeAt(_local5));
                _local5++;
            };
            this.writeLineBreak();
            this.writeLineBreak();
            _arg2.position = 0;
            this.postData.writeBytes(_arg2, 0, _arg2.length);
            this.writeLineBreak();
        }
        public function createPostData():void{
            this.postData = new ByteArray();
            this.postData.endian = Endian.BIG_ENDIAN;
        }
        public function writePostData(_arg1:String, _arg2:String):void{
            var _local3:String;
            this.writeBoundary();
            this.writeLineBreak();
            _local3 = (("Content-Disposition: form-data; name=\"" + _arg1) + "\"");
            var _local4:uint = _local3.length;
            var _local5:Number = 0;
            while (_local5 < _local4) {
                this.postData.writeByte(_local3.charCodeAt(_local5));
                _local5++;
            };
            this.writeLineBreak();
            this.writeLineBreak();
            this.postData.writeUTFBytes(_arg2);
            this.writeLineBreak();
        }
        public function get boundary():String{
            return (this._boundary);
        }
        protected function writeLineBreak():void{
            this.postData.writeShort(3338);
        }
        public function close():void{
            this.writeBoundary();
            this.writeDoubleDash();
        }
        protected function writeQuotationMark():void{
            this.postData.writeByte(34);
        }
        public function set boundary(_arg1:String):void{
            this._boundary = _arg1;
        }

    }
}//package com.facebook.utils 
